<?php
###
#  Baing PHP 框架 1.0.0
#  http://baing.co/
#
#  Copyright: 白晓阳
#  License: CC BY-NC-SA 4.0
#  https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh
###

namespace bai\action;

use bai\resource\document\Download as DownloadDoc;


class Download extends \bai\Action
{
    public function run()
    {
        $resource = self::$process->resource ?: DownloadDoc::RESOURCE_DEFAULT;
        $doc = DownloadDoc::setup([
            'path' => self::$request->query[$resource] ?? '']
        );
        self::$response->addResource($doc);
        return $this->next();
    }
}
